﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Project_Udrinkwater.PagesAdmin
{
    public partial class MeterialList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["Order_Material_ID"] = Session["sOrder_Material_ID"];
            ShowdataHead();
        } 
        protected void gvDetial_BeforePerformDataSelect(object sender, EventArgs e)
        {
            Session["Order_Material_ID"] = Session["sOrder_Material_ID"];
        }
        private void ShowdataHead()
        {
            DataTable dt = new DataTable();
            DataTable ds = new DataTable();
            DataView dvSql = (DataView)SqlMainGV.Select(DataSourceSelectArguments.Empty);

            dt = dvSql.ToTable();
            txtDocNO.Text   = dt.Rows[0]["Order_Material_doc_NO"].ToString();
            txtDateDoc.Text = dt.Rows[0]["Order_material_Date"].ToString();
            txtDueDate.Text = dt.Rows[0]["Due_Date"].ToString();
            txtCondition.Text = dt.Rows[0]["Condition_Pay"].ToString();
            txtSplierName.Text = dt.Rows[0]["Supplier_Name"].ToString();
            txtAddress.Text = dt.Rows[0]["Adress"].ToString();
        }
        //SqlMainGV
       //SELECT TB_Order_Material.Order_Material_ID, TB_Order_Material.Order_Material_doc_NO, TB_Order_Material.Order_material_Date,
        //TB_Order_Material.Supplier_ID, TB_Order_Material.Due_Date, TB_Order_Material.Condition_Pay, TB_Supplier.Supplier_Name TB_Supplier.Adress  FROM 
            //TB_Order_Material INNER JOIN TB_Supplier ON TB_Order_Material.Supplier_ID = TB_Supplier.Supplier_ID WHERE 
               // (TB_Order_Material.Order_Material_ID = @Order_Material_ID)
        protected void SqlMainGV_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            e.Command.Parameters["@Order_Material_ID"].Value = Session["sOrder_Material_ID"].ToString();
        }

       
    }
}